package com.unicorn.base;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

/**
 * Created by windy on 16-11-3.
 * 系统数据源配置
 */
@Configuration
public class UnicornDataSource {

    @Autowired
    private UnicornDataSourceProp prop;

    @Bean
    public DriverManagerDataSource getDataSource() {
        dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName(prop.driver);
        dataSource.setPassword(prop.password);
        dataSource.setUrl(prop.url);
        dataSource.setUsername(prop.username);
        return  dataSource;

    }

    public void setDataSource(DriverManagerDataSource dataSource) {
        this.dataSource = dataSource;
    }

    private DriverManagerDataSource dataSource;





}
